<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" th:with="title='sys_job'">
<meta charset="utf-8">
<header th:replace="header::header(${title})"></header>
<body class="gray-bg">
	<div class="wrapper wrapper-content ">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-content">
						<form class="form-horizontal m-t" id="JobForm">
							<div class="form-group">
								<label class="col-sm-3 control-label">任务名称：</label>
								<div class="col-sm-8">
									<input id="jobName" name="jobName" class="form-control" type="text">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">任务组名：</label>
								<div class="col-sm-8">
									<input id="jobGroup" name="jobGroup" class="form-control" type="text">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">任务方法：</label>
								<div class="col-sm-8">
									<input id="jobClassName" name="jobClassName" class="form-control" type="text">
								</div>
							</div>
<!-- 							<div class="form-group" hidden=""> -->
<!-- 								<label class="col-sm-3 control-label">方法参数：</label> -->
<!-- 								<div class="col-sm-8"> -->
<!-- 									<input id="methodParams" name="methodParams" class="form-control" type="text"> -->
<!-- 								</div> -->
<!-- 							</div> -->
							<div class="form-group">
								<label class="col-sm-3 control-label">任务描述：</label>
								<div class="col-sm-8">
									<input id="description" name=description class="form-control" type="text">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">备注信息：</label>
								<div class="col-sm-8">
									<textarea id="remark" name="remark" class="form-control">[[*{remark}]]</textarea>
								</div>
							</div>
							<div class="form-group">
								<div class="col-sm-8 col-sm-offset-3">
									<button type="submit" class="btn btn-primary">提交</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div th:replace="footer :: footer"></div>
	<script type="text/javascript">
		var prefix = ctx + "sys/job";
        $().ready(function() {
	        validateRule();
        });
        $.validator.setDefaults({
	        submitHandler : function() {
		        save();
	        }
        });
        function save() {
	       YiMo.ajaxPost({
	            url : prefix + "/save",
	            data : $('#JobForm').serialize(),
	            needClose : true,
	            parentRefresh : true,
	        });
        }

        function validateRule() {
	        var icon = "<i class='fa fa-times-circle'></i> ";
	        $("#JobForm").validate({
	            rules : {
	                jobName : {
		                required : true
	                },
	                jobGroup : {
		                required : true
	                },
	                methodName : {
		                required : true
	                },
	                cronExpression : {
		                required : true
	                },
	                misfirePolicy : {
		                required : true
	                },
	            },
	            messages : {
	            	 jobName : {
			                required : icon + "请输入任务名称"
		                },
		                jobGroup : {
			                required : icon + "请输入任务组名"
		                },
		                jobClassName : {
			                required : icon + "请输入任务方法"
		                },
		                methodParams : {
			                required : icon + "请输入方法参数"
		                },
		                cronExpression : {
			                required : icon + "请输入cron执行表达式"
		                },
		                misfirePolicy : {
			                required : icon + "请输入计划执行策略"
		                },
	            }
	        })
        }
	</script>
</body>
</html>
